package id.laskarmedia.opnvpn_flutter.util;

import android.util.Log;

import org.json.JSONException;
import org.json.JSONObject;

import id.laskarmedia.opnvpn_flutter.bean.ConnectStatus;

public class ConnectStateHelper {
    private static final ConnectStatus connectStatus = new ConnectStatus();

    public static void setConnectStatus(Long connected_on,String byteIn,String byteOut){
        connectStatus.setByteOut(byteOut);
        connectStatus.setByte_in(byteIn);
        connectStatus.setConnected_on(connected_on);
    }

    public static String toJSONString() {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("connected_on",connectStatus.getConnected_on());
            jsonObject.put("byte_in",connectStatus.getByte_in());
            jsonObject.put("byte_out",connectStatus.getByteOut());
            return jsonObject.toString();
        } catch (JSONException e) {
            Log.e("ConnectStateHelper",e.toString());
        }
        return null;
    }
}
